home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / win / steph1b0.zip / STEPH.H < prev    next >
Text File  |  1994-10-30  |  37KB  |  1,179 lines

  1. /* STEPH.H
  2.    Stephen Morphet & Through The DOS Window
  3.  
  4.    Include file for the Steph library.
  5.    (c) 1993, 1994 SDM/TTDW
  6.  
  7.    You should #include this file in any source file that accesses the
  8.    Steph system.
  9.  
  10.    *** WARNING ***
  11.  
  12.    This file incorporates constants, macros and functions prototypes
  13.    that are needed by the Steph system.
  14.  
  15.  
  16.    *** DO NOT EDIT THIS FILE. ***
  17.  
  18.    You CANNOT customise Steph by altering this file.  Doing so will cause
  19.    Steph to become unstable and may cause a system crash.
  20.  
  21.    You CAN customise the behaviour of Steph as described in the manual.
  22.  
  23.  
  24.    *** IMPORTANT ***
  25.  
  26.    The data structures described below are all available to code linked to
  27.    the Steph library.   Many of the structure member variables are useful
  28.    and are documented in the manual.  Those that are not documented are for
  29.    internal use by the system and should not be changed.  No attempt has
  30.    been made in this file to identify those variables.
  31.  
  32. */
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65. #if !defined( WM_WM_HEADER )
  66. #define WM_WM_HEADER
  67.  
  68. /* types */
  69. typedef void(*vfnptr)();      /* pointer to a void function */
  70. typedef unsigned char byte;
  71.  
  72.  
  73. /* macros */
  74.  
  75.  
  76. #if !defined( MK_FP )
  77. #define MK_FP(seg, ofs) ((void far *) ((unsigned long) (seg)<<16|(ofs)))
  78. #endif
  79.  
  80. /* macros to extract from _menu_spec.border[]   eg.  "┌─┐│ │└─┘├─┤√" */
  81. /*                                                    0123456789012  */
  82. #define M_TOPLEFT    *_menu_spec.border
  83. #define M_TOPRIGHT   *(_menu_spec.border + 2)
  84. #define M_BOTLEFT    *(_menu_spec.border + 6)
  85. #define M_BOTRIGHT   *(_menu_spec.border + 8)
  86. #define M_TOP        *(_menu_spec.border + 1)
  87. #define M_BOTTOM     *(_menu_spec.border + 7)
  88. #define M_LEFT       *(_menu_spec.border + 3)
  89. #define M_RIGHT      *(_menu_spec.border + 5)
  90. #define M_CROSSLEFT  *(_menu_spec.border + 9)
  91. #define M_CROSSRIGHT *(_menu_spec.border + 11)
  92. #define M_CROSS      *(_menu_spec.border + 10)
  93. #define M_BLANKGAP   *(_menu_spec.border + 4)
  94. #define M_CHECK      *(_menu_spec.border + 12)
  95.  
  96. /* macros to extract from window borders */
  97.  
  98. #define W_TOPLEFT    *(_window_spec.border)
  99. #define W_TOPRIGHT   *(_window_spec.border + 2)
  100. #define W_BOTLEFT    *(_window_spec.border + 6)
  101. #define W_BOTRIGHT   *(_window_spec.border + 8)
  102. #define W_TOP        *(_window_spec.border + 1)
  103. #define W_BOTTOM     *(_window_spec.border + 7)
  104. #define W_LEFT       *(_window_spec.border + 3)
  105. #define W_RIGHT      *(_window_spec.border + 5)
  106. #define W_CTRLLEFT   *(_window_spec.border + 9)
  107. #define W_CTRLRIGHT  *(_window_spec.border + 10)
  108. #define W_MAX        *(_window_spec.border + 11)
  109. #define W_MIN        *(_window_spec.border + 4)
  110. #define W_CLOSE      *(_window_spec.border + 12)
  111. #define W_TOPL2      *(_window_spec.border + 14)
  112. #define W_TOPR2      *(_window_spec.border + 15)
  113. #define W_SCROLL     *(_window_spec.border + 16)
  114. #define W_SCRUP      *(_window_spec.border + 17)
  115. #define W_SCRDOWN    *(_window_spec.border + 18)
  116. #define W_SCRLEFT    *(_window_spec.border + 19)
  117. #define W_SCRRIGHT   *(_window_spec.border + 20)
  118. #define W_SCRBLIP    *(_window_spec.border + 21)
  119.  
  120. /* macros to extract dbox drawing characters */
  121.  
  122. #define _DB_TOPLEFT  *_dbox_spec.border
  123. #define _DB_TOP      *(_dbox_spec.border + 1)
  124. #define _DB_TOPRIGHT *(_dbox_spec.border + 2)
  125. #define _DB_LEFT     *(_dbox_spec.border + 3)
  126. #define _DB_PAGE     *(_dbox_spec.border + 4)
  127. #define _DB_RIGHT    *(_dbox_spec.border + 5)
  128. #define _DB_BOTLEFT  *(_dbox_spec.border + 6)
  129. #define _DB_BOT      *(_dbox_spec.border + 7)
  130. #define _DB_BOTRIGHT *(_dbox_spec.border + 8)
  131. #define _DB_BUTTONL  *(_dbox_spec.border + 9)
  132. #define _DB_BUTTONR  *(_dbox_spec.border + 10)
  133. #define _DB_CHECKL   *(_dbox_spec.border + 11)
  134. #define _DB_CHECK    *(_dbox_spec.border + 12)
  135. #define _DB_UNCHECK  *(_dbox_spec.border + 13)
  136. #define _DB_CHECKR   *(_dbox_spec.border + 14)
  137. #define _DB_RADIOL   *(_dbox_spec.border + 15)
  138. #define _DB_RADIO    *(_dbox_spec.border + 16)
  139. #define _DB_RADIOR   *(_dbox_spec.border + 17)
  140. #define _DB_TEXTL    *(_dbox_spec.border + 18)
  141. #define _DB_TEXT     *(_dbox_spec.border + 19)
  142. #define _DB_TEXTR    *(_dbox_spec.border + 20)
  143. #define _DB_SCROLL   *(_dbox_spec.border + 21)
  144. #define _DB_LSCROLL  *(_dbox_spec.border + 22)
  145. #define _DB_RSCROLL  *(_dbox_spec.border + 23)
  146. #define _DB_USCROLL  *(_dbox_spec.border + 24)
  147. #define _DB_DSCROLL  *(_dbox_spec.border + 25)
  148. #define _DB_SCRBLIP  *(_dbox_spec.border + 26)
  149. #define _DB_BARL     *(_dbox_spec.border + 27)
  150. #define _DB_BAR      *(_dbox_spec.border + 28)
  151. #define _DB_BARR     *(_dbox_spec.border + 29)
  152. #define _DB_COMBO    *(_dbox_spec.border + 30)
  153.  
  154. /* macros to extract speed bar boundary characters */
  155.  
  156. #define _SB_BUTTONL   *(_speed_spec.border);
  157. #define _SB_SPACE    *(_speed_spec.border + 1);
  158. #define _SB_BUTTONR   *(_speed_spec.border + 2);
  159.  
  160.  
  161. #define WGNF _window_getnextfree()
  162. #define WGLB _window_spec.lastbuilt
  163.  
  164. #define MGNF _menu_getnextfree()
  165. #define MGLB _menu_spec.lastbuilt
  166.  
  167. /* Mouse buttons left/right/centre up or down.
  168.    Suitable for testing data as returned by int33h fn03h regBX
  169.    e.g. function _mouse_nowbutton() */
  170.  
  171. #define MBL_ISDOWN(sbyte)   (((sbyte)&&0x01) ? -1 :  0)
  172. #define MBL_ISUP(sbyte)     (((sbyte)&&0x01) ?  0 : -1)
  173. #define MBR_ISDOWN(sbyte)   (((sbyte)&&0x02) ? -1 :  0)
  174. #define MBR_ISUP(sbyte)     (((sbyte)&&0x02) ?  0 : -1)
  175. #define MBC_ISDOWN(sbyte)   (((sbyte)&&0x04) ? -1 :  0)
  176. #define MBC_ISUP(sbyte)     (((sbyte)&&0x04) ?  0 : -1)
  177.  
  178. /* convert character lines to/from mouse coordinates in pixels */
  179. /* Note: X and Y scalings are different, and dependant on video mode */
  180.  
  181. #define xch2pix(chars)      ((chars) * __gminfo.xchar)
  182. #define xpix2ch(chars)      ((chars) / __gminfo.xchar)
  183. #define ych2pix(chars)      ((chars) * __gminfo.ychar)
  184. #define ypix2ch(chars)      ((chars) / __gminfo.ychar)
  185.  
  186.  
  187. /* constants */
  188.  
  189. /* maxima */
  190.  
  191. #define __MAXWINDOWS    16   /* max number of windows allowed */
  192. #define __WBMAXLINES  1024   /* max number of lines in a window buffer */
  193. #define __MAXMENUS      16   /* number of menus allowed */
  194. #define __MAXPOPMENUS    4   /* number of popup menus allowed */
  195. #define __MENUITEMLEN   60   /* max number + 1 of chars in a menu entry */
  196. #define __MAXDBOX       32   /* max number of dboxes */
  197. #define __MAXDBOXCTRL   16   /* number of controls allowed in a dbox */
  198. #define __MAXBARLIST     4   /* number of horizontal bars allowed in a dbox */
  199. #define __MAXTEXTCHAR 1024   /* max number of chars allowed in a text control */
  200. #define __MAXDBOXDEP    16   /* max number of dependant dboxes */
  201. #define __MAXMENUEDGE    5   /* hilite bar max overlap at edge of text */
  202. #define __MAXTOOLBARS    4   /* number of tool bar lines allowed */
  203. #define __MAXTOOLCONTROLS 16 /* number of tool bar controls */
  204. #define __MAXSPEEDBUTTONS 16 /* number of speed bar buttons */
  205.  
  206. #define _COLOUR   -1
  207. #define _K_MODE    0              /* internal use */
  208. #define _MDAHERC    1              /* text screen mode types */
  209. #define _NOTTEXT    2
  210.  
  211. /* constants used for overriding exit mode of dialogue controls   */
  212. /* (more constants in PRIVATE.H, not available to programmers...) */
  213.  
  214. #define _CA_ESC    2
  215. #define _CA_SET    3
  216. #define _CA_NOEXIT 3         /* _CA_NOEXIT == _CA_SET */
  217. #define _CA_EXIT   4
  218.  
  219. /* gmode values for use in _steph_initialise() calls */
  220.  
  221. #define M_GRAPHIC -1
  222. #define M_TEXT     0
  223.  
  224. /* window types */
  225.  
  226. #define WP_NONE    0
  227. #define WP_MAIN    1
  228. #define WP_TOP     2
  229. #define WP_BOT     3
  230.  
  231. /* constants for window control buttons */
  232.  
  233. #define WC_CLOSE       1
  234. #define WC_MAX         2
  235. #define WC_MIN         4
  236. #define WC_HSCROLL     8
  237. #define WC_VSCROLL    16
  238.  
  239. #define WC_SCRINHIB    32   /* for internal use */
  240.  
  241. /* window return action codes */
  242.  
  243. #define WR_NOACTION  255
  244. #define WR_SELECT      0
  245. #define WR_CLOSE       1
  246. #define WR_MAX         2
  247. #define WR_MIN         3
  248. #define WR_SIZE        4
  249. #define WR_VUP         5
  250. #define WR_VDOWN       6
  251. #define WR_VDRAG       7
  252. #define WR_HUP         8
  253. #define WR_HDOWN       9
  254. #define WR_HDRAG      10
  255. #define WR_VPUP       11
  256. #define WR_VPDOWN     12
  257. #define WR_HPUP       13
  258. #define WR_HPDOWN     14
  259.  
  260. /* window draw mode codes */
  261.  
  262. #define WD_AUTO      0
  263. #define WD_USER           1
  264. #define WD_CLEAR        2
  265. #define WD_COLOUR    3
  266.  
  267. #define _WD_CCODE 255          /* colour code for WD_COLOUR mode */
  268.  
  269. /* Null pointers for various purposes */
  270.  
  271. #define NOFN    (vfnptr)NULL   /* no attached function */
  272. #define DFILTER (vfnptr)NULL   /* meaning default filter */
  273. #define NOTEXT  (char *)NULL   /* no text */
  274.  
  275. /* Miscellaneous TRUE/FALSE type constants */
  276.  
  277. #define ON -1
  278. #define OFF 0
  279.  
  280. #define EVENT 255
  281. #define NOEVENT 0
  282.  
  283. #define FALSE 0
  284. #define TRUE -1
  285.  
  286. #define GREY   -1
  287. #define NOTGREY 0
  288.  
  289. #define TRUE -1
  290. #define FALSE 0
  291.  
  292. #define OPEN  -1
  293. #define CLOSED 0
  294.  
  295. #define LEFT -1
  296. #define RIGHT 0
  297.  
  298. #define _UP  -1
  299. #define _DOWN 0
  300.  
  301. #define ENABLED -1
  302. #define DISABLED 0
  303.  
  304. /* Constants for checkable menu items. */
  305. /* pass only ON, OFF, TOGGLE to the _menu_check function */
  306.  
  307. #define NOCHECK     1
  308. #define CHECKON    -1
  309. #define CHECKOFF    0
  310. #define CHECKTOGGLE 2
  311. #define CHECKERROR  3
  312.  
  313. /* Dialogue box buttons.  Exit mode flags. */
  314.  
  315. #define EXIT   1
  316. #define NOEXIT 0
  317. #define ESCAPE 2
  318.  
  319. /* Return codes from query boxes */
  320.  
  321. #define QB_FAIL   -2
  322. #define QB_NONE   -1
  323.  
  324. /* Used to specify a horizontal bar in query_button_gap */
  325.  
  326. #define QB_BAR    -1
  327.  
  328. /* Dialogue box positions */
  329.  
  330. #define DB_CENSCR  0
  331. #define DB_CENWIN  1
  332. #define DB_ABSPOS  2
  333.  
  334. /* Toolbar control types */
  335.  
  336. #define TB_NONE      0
  337. #define TB_COMBO     1
  338. #define TB_BUTTON    2
  339. #define TB_TOGGLE    3
  340.  
  341. /* list box scroll bars */
  342. /* a list box can have none, one or the other, but not both */
  343.  
  344. #define DBL_HSCROLL  0
  345. #define DBL_VSCROLL  1
  346. #define DBL_NOSCROLL 2
  347.  
  348. /* Dialogue box dependancy and horizontal bars */
  349.  
  350. #define _NO_DEPENDANT -1
  351. #define _NO_BAR        0
  352.  
  353.  
  354. /* structure for window contents, line by line in a linked list */
  355.  
  356. struct winbuflist
  357. {
  358.    char *line;                /* Pointer to dynamic text string */
  359.    int endcode;               /* User controlled data value */
  360.    struct winbuflist *link;   /* next struct in list */
  361.     struct winbuflist *prev;   /* previous struct in list */
  362. };
  363.  
  364.  
  365. /* structures for global variables set up by steph. */
  366.  
  367. /* global system information */
  368.  
  369. typedef struct
  370. {
  371.    char steph_running;  /* Is steph running yet?  Closed down?   */
  372.  
  373.    int mode;            /* text screen mode, ie. colour or b&w   */
  374.    char gmode;          /* graphics or text screen mode */
  375.  
  376.    unsigned row, col;   /* screen size in characters */
  377.  
  378.    short launch_cursor; /* cursor shape on startup */
  379.    int launch_insmode;  /* insert mode on startup */
  380.  
  381.    short cursor;
  382.    short otcursor;      /* cursor shapes for insert and overtype modes */
  383.  
  384.    char cursor_vis;     /* current cursor visibility */
  385.    short hidden_cursor; /* cursor shape currently hidden if any */
  386.    char cursorr;
  387.    char cursorc;        /* cursor row and column last set */
  388.  
  389.    char speak;          /* Speak mode. */
  390.                         /* Reserved for future speech-synth extensions */
  391.  
  392.    vfnptr mem_handler;  /* function called when memory alloc error occurs */
  393.    char mem_flag;       /* flag set TRUE in mem_handler to reattempt alloc */
  394.  
  395.    unsigned long mem_size;
  396.                         /* amount of memory requested by last alloc
  397.                            so that mem_handler can try to free that much */
  398.                         /* in rare situations may return 0.  Either the system
  399.                            failed to allocate a zero length block (possible) or
  400.                            Steph was unable to determine the block size
  401.                         */
  402.  
  403.    char _no_store;      /* disables background storing - used in critical
  404.                            low memory situations */
  405.  
  406.    char *nomemlist;     /* pointer out of memory message list */
  407.  
  408. }__ss_tag;
  409.  
  410.  
  411. /* individual menu description */
  412.  
  413. typedef struct
  414. {
  415.    unsigned itemcount;  /* number of items */
  416.    unsigned longest;    /* longest item in menu body, excl. title */
  417.    char *menuinfo;      /* store menu texts */
  418.    char *hotkeys;       /* store position of hotkey in text */
  419.    char *hotalpha;      /* store actual hotkey letter */
  420.    char *enabled;       /* store grey out info */
  421.    char *check;         /* store check marks info */
  422.    vfnptr *funcp;       /* ptr to start of function pointer list */
  423.    char **helptextp;    /* ptr to list of speed bar help items */
  424.    char *behind;         /* pointer to whatever's behind the pull down */
  425.    int onleft;          /* what is to the left of the menu? */
  426. }__md_tag;
  427.  
  428.  
  429. /* structure for individual window description */
  430.  
  431. typedef struct
  432. {
  433.    char type;     /* main, top or bottom */
  434.    char numrows;  /* number of rows available inside the window */
  435.  
  436.    char *title;   /* pointer to the title string */
  437.    char isopen;   /* window visibility */
  438.    char wasopen;  /* used to determine whether to turn the bar off */
  439.  
  440.    char controls; /*   bits tell us which controls are active, 1=on   */
  441.                   /*   bit0   close            1                      */
  442.                   /*      1   max              2                      */
  443.                   /*      2   min              4                      */
  444.                   /*      3   vscroll          8                      */
  445.                   /*      4   hscroll          16                     */
  446.                   /*      5   scrollinhibit    32 (system use only)   */
  447.                   /*      6                    64                     */
  448.                   /*      7                   128                     */
  449.  
  450.    char haschanged;  /* has the window been changed? */
  451.  
  452.    char usetop;      /* usable region within window */
  453.    char usebottom;
  454.  
  455.    char startrow;
  456.    unsigned char oldstartrow;
  457.  
  458.    char vsblip;
  459.    char hsblip;      /* position of the scroll bar blips in characters */
  460.    char vsbold;
  461.    char hsbold;      /* last position of scroll bar blips */
  462.  
  463.    short paper;      /* window contents colours */
  464.    short ink;
  465.  
  466.    char fix_lines;   /* number of fixed lines at top of window */
  467.    short fix_paper;
  468.    short fix_ink;    /* colours for fixed lines */
  469.  
  470.    struct winbuflist buffer;  /* start of the window contents linked list */
  471.    struct winbuflist *pwb;    /* working pointer to window buffer list */
  472.  
  473.    unsigned current_line;     /* the current line in the buffer */
  474.    unsigned blines;           /* number of lines in the buffer,
  475.                                  note they are numbered 0 to blines-1 */
  476.    unsigned blong;
  477.  
  478.    unsigned lineo;            /* line offset, ie, line of buffer to show
  479.                                  at top of window */
  480.    unsigned charo;            /* character offset, ie, character to
  481.                                  show at left of window */
  482.  
  483.    char drawmode;             /* eg WD_DEFAULT or WD_USER (re)draw mode */
  484.    vfnptr drawfn;             /* user draw function */
  485.  
  486.    vfnptr filter;             /* keystroke filter for the window */
  487.    vfnptr keyaction;          /* window keyboard action function */
  488.  
  489.    vfnptr close;
  490.    vfnptr max;
  491.    vfnptr min;
  492.    vfnptr size;
  493.    vfnptr vup;
  494.    vfnptr vdown;
  495.    vfnptr vdrag;
  496.    vfnptr vpup;
  497.    vfnptr vpdown;
  498.    vfnptr hup;
  499.    vfnptr hdown;
  500.    vfnptr hdrag;
  501.    vfnptr hpup;
  502.    vfnptr hpdown;
  503.    vfnptr unselect;
  504.    vfnptr select;
  505.    vfnptr activate;            /* window activity function hooks */
  506.  
  507. }__wd_tag;
  508.  
  509.  
  510. /* global window information */
  511.  
  512. typedef struct
  513. {
  514.    unsigned active;     /* which window is active? */
  515.    unsigned wasactive;  /* which window was active? */
  516.  
  517.    int maximise;        /* number of window that is maximised or -1 */
  518.    char premaxrows;     /* size of the maxed window, before it was maxed */
  519.    char hsbat;          /* posn of horiz scrollbar in last window, or -1 */
  520.  
  521.    int lastbuilt;       /* last window built */
  522.    unsigned wincount;   /* number of windows built */
  523.  
  524.    unsigned ttop;       /* the toppest top window */
  525.    unsigned btop;       /* the lowest top window */
  526.    unsigned tbottom;    /* the toppest bottom window */
  527.    unsigned bbottom;    /* the lowest bottom window */
  528.  
  529.    char control_gap;
  530.    char title_gap;      /* spacing sizes */
  531.  
  532.    char sbinhib;        /* window size at which scrollbars are inhibited */
  533.  
  534.    short border_paper;
  535.    short border_ink;
  536.    short title_hilite;
  537.    short title_ink;
  538.    short title_paper;
  539.    short scroll_paper;
  540.    short scroll_ink;
  541.    short drag_paper;
  542.    short drag_ink;      /* window border colours */
  543.  
  544.    char border[23];     /* window border characters */
  545.  
  546.    byte mousecode;      /* button set to trigger window actions */
  547.    byte mousecontrol;   /* buttons for window controls, must be a
  548.                            subset of mousecode   */
  549.  
  550.    unsigned firstrow;   /* first row that we can put text on */
  551.    unsigned lastrow;    /* last row on screen that we can use */
  552.  
  553.    char key1;           /* key passed to window by the filter */
  554.    char key2;           /* key to pick up cursors etc when key1 == 0 */
  555.  
  556.    char syskeyflag;     /* set TRUE by filter if sys key is matched */
  557.  
  558.    unsigned last_action_window;   /* set by window action fn */
  559.    byte last_action_code;         /* ditto */
  560.    byte last_mouse_button;        /* the mouse button used */
  561.  
  562.    int scrinfo;         /* return data from scrollbar action */
  563.    char selectx;
  564.    char selecty;        /* window activity return codes */
  565.  
  566.    vfnptr sysfilter;    /* function to test if it is a sys key */
  567.    vfnptr syskeyaction; /* function called when system key found */
  568.  
  569. }__ws_tag;
  570.  
  571.  
  572. /* global menu information */
  573.  
  574. typedef struct
  575. {
  576.    vfnptr initialfunc;  /* system initialisation function */
  577.    vfnptr loopfunc;     /* loop function pointer */
  578.  
  579.    vfnptr menuloopfunc; /* menu loop function pointer */
  580.    vfnptr dboxloopfunc; /* dialogue box loop function pointer */
  581.  
  582.    unsigned lastbuilt;  /* last menu built */
  583.    int lastmenuselect;
  584.    int lastitemselect;  /* last selection made */
  585.  
  586.    unsigned lastpopbuilt;   /* last popup menu built */
  587.    int lastpopmenuselect;
  588.    int lastpopitemselect;   /* last popup selection made */
  589.  
  590.    char anyonright;     /* set TRUE is there are rhs windows */
  591.  
  592.    short bar_ink;
  593.    short bar_paper;
  594.    short bar_hotkey;
  595.    short bar_disabled;  /* colours for menu bar at top of screen */
  596.  
  597.    short body_ink;
  598.    short body_paper;
  599.    short body_hotkey;
  600.    short body_disabled; /* colours for menu body */
  601.  
  602.    char body_space;
  603.    char body_offset;
  604.    char bar_space;
  605.    char bar_hilite_edge;     /* spacing data */
  606.  
  607.    int  bar_gothilite;
  608.    int  body_menugothilite;
  609.    int  body_itemgothilite;  /* highlight/cursor position info */
  610.  
  611.    char bar_hotkeyson;       /* (body hotkeys are always on) */
  612.  
  613.    char shadow_below;
  614.    char shadow_right;
  615.    char shadow_ink;
  616.    char shadow_paper;        /* shadow sizes */
  617.  
  618.    char border[14];          /* menu drawing characters (incl. popups) */
  619.  
  620.    char mousetoopen;         /* activation button */
  621.  
  622.    char popmenu;             /* true when popup menus active */
  623.    char popmenurow;          /* popup menu position of top left on screen */
  624.    char popmenucol;
  625.    char pop_left;            /* mouse popups hang on top-l corner if true */
  626.  
  627.    char user_activate;       /* who started the menus? - normally TRUE */
  628.  
  629. }__ms_tag;
  630.  
  631.  
  632. /* dialogue box global info */
  633.  
  634. typedef struct
  635. {
  636.    unsigned active;            /* set while a dbox in on screen */
  637.  
  638.    char border[32];            /* drawing characters */
  639.  
  640.    char isopen[__MAXDBOX];     /* used to decide if a dialogue is open */
  641.  
  642.    short ink;
  643.    short hotkey;
  644.    short paper;
  645.    short shadow_ink;
  646.    short shadow_paper;         /* colours for paper & border */
  647.  
  648.    short drag_ink;
  649.    short drag_paper;           /* colour of drag outline */
  650.    short grey;                 /* greyed out controls colour */
  651.  
  652.    char lift;                  /* window lift value */
  653.  
  654.    float scrollsecs;           /* number of secs to pause when scrolling */
  655.    float dclick;               /* double click time delay secs */
  656.  
  657.    char shadow_right;
  658.    char shadow_below;          /* size of shadows */
  659.    char lbox_eofield;          /* list box field spacing */
  660.  
  661.    int cclose;                 /* set to the control number if combo */
  662.                                /* is still open */
  663.  
  664.    char _ca_ret;               /* control activity return value */
  665.    char _ca_activator;         /* mouse or kbd activation flag */
  666.    char _ca_hotkey;            /* hotkey store */
  667.    unsigned char filter_key;   /* key for pass to filter functions */
  668.    unsigned char filter_key2;  /* another key for filtering */
  669.  
  670.    /* info for flash boxes */
  671.    short flash_ink;
  672.    short flash_paper;          /* colours */
  673.  
  674.    char flash_vgap;            /* space above & below text */
  675.    char flash_hgap;            /* space to left and right of text */
  676.  
  677.    char *flash_behind;   /* store background for flash boxes */
  678.  
  679.    /* query boxes are just dboxes, so we use same colours etc... */
  680.  
  681.    char query_button_gap;      /* space between text & buttons */
  682.    char query_button_space;    /* between buttons & chevrons */
  683.    char query_button_spacing;  /* space between buttons */
  684.    char query_bar_gap;         /* space above or below bars */
  685.  
  686.    char query_drags;           /* are querys draggable? */
  687.    char dbox_drags;            /* default for draggable */
  688.    char dbox_snap;             /* default for snapback */
  689.  
  690.    char _tb_control;           /* set TRUE when dbox system is managing
  691.                                   toolbar combo box activity else FALSE */
  692.    char _query_control;        /* ditto for query box */
  693.  
  694.    char bulkflag;              /* set TRUE when bulk control drawing */
  695.  
  696.    char *dback_t;         /* stores for background of outline during
  697.                                   dbox drag */
  698. }__ds_tag;
  699.  
  700.  
  701. /* dialogue box control description */
  702.  
  703. typedef struct
  704. {
  705.    char type;                 /* the type of control */
  706.    char grey;
  707.    char info;                 /* info (usages depend on control type) */
  708.    char inf2;                 /* more info */
  709.    int  inf3;                 /* more info */
  710.    char inf4;                 /* yet more info */
  711.    char hotkey;               /* the position in title of hotkey */
  712.    char alpha;                /* the hotkey letter */
  713.  
  714.    char oldblip;              /* store of where scroll blip used to be */
  715.  
  716.    char xpos;
  717.    char ypos;                 /* position, 0-based on top left of dbox */
  718.    char xsize;
  719.    char ysize;
  720.  
  721.    char *behind;               /* needed for combo box pop down */
  722.  
  723.    int iret;                  /* integer return */
  724.    int oldi;                  /* stores old iret value for esc returns */
  725.  
  726.    char *bret;                /* pointer to buffer for content/return */
  727.  
  728.    char *init;                /* pntr to init-buffer passed to control */
  729.  
  730.    vfnptr sfunc;              /* function called when control 'select'ed */
  731.    vfnptr hfunc;              /* second user defined function */
  732.                               /* (list/combo hilite change) */
  733. }_dbctrl;
  734.  
  735.  
  736. /* dialogue box descriptions */
  737.  
  738. typedef struct
  739. {
  740.    char position;             /* location/centering code */
  741.    char xsize;
  742.    char ysize;                /* size */
  743.  
  744.    char xpos;
  745.    char ypos;                 /* position */
  746.  
  747.    char *title;               /* title on the dialogue's top edge */
  748.    char *speedtext;           /* help text etc for the speedbar */
  749.  
  750.    char *behind;               /* pointer to store of what's behind */
  751.    char barlist[__MAXBARLIST];/* where are the cross bars? */
  752.  
  753.    char ccount;               /* the number of controls on the box */
  754.    _dbctrl *control;   /* pointer to start of list of controls */
  755.  
  756.    int dependant[__MAXDBOXDEP];
  757.                               /* list of dependants */
  758.  
  759.    char *escstore;            /* pointer to buffer of ESC stored info */
  760.    vfnptr global_key_filter;  /* filter for global keystrokes */
  761.    vfnptr global_key_action;  /* function called when global key hit */
  762.  
  763.    char draggable;            /* TRUE if dbox can be positioned */
  764.    char snapback;             /* TRUE = pops up next time in drag posn
  765.                                  or FALSE, snaps back to start pos (dflt) */
  766. }__dd_tag;
  767.  
  768.  
  769. /* speed bar global info */
  770.  
  771. typedef struct
  772. {
  773.    short paper;
  774.    short ink;           /* define colour of bar */
  775.  
  776.    char *bartext;       /* pointer to the bar text */
  777.    vfnptr function;     /* user hook, called when speed bar redrawn */
  778.    vfnptr clickfn;      /* user hook, called when sb is M_ANYPRESSed */
  779.    char textindent;     /* indent text from _speed_text function */
  780.    char isdef;          /* set TRUE when default bar is on screen */
  781.    char maxlen;         /* number of characters to show */
  782.  
  783.    char border[4];      /* button border characters */
  784.  
  785.    char button_indent;  /* where do the buttons start */
  786.    char button_space;   /* space between text & chevron   */
  787.    char button_spacing; /* space between buttons */
  788.  
  789. }__ssb_tag;
  790.  
  791.  
  792. /* speed bar buttons */
  793.  
  794. typedef struct
  795. {
  796.    char *text;          /* the button text */
  797.    char chevron;        /* does the button have chevrons */
  798.  
  799.    short paper;
  800.    short ink;           /* button colour */
  801.  
  802.    char start;
  803.    char end;            /* position of button */
  804.  
  805.    vfnptr bclick;       /* hooked function to button click */
  806.  
  807. }__sbb_tag;
  808.  
  809.  
  810. /* toolbar global info */
  811.  
  812. typedef struct
  813. {
  814.    short paper;       /* colour of toolbar */
  815.    short ink;
  816.    short grey;        /* colour of grey control */
  817.  
  818.    char nlines;       /* number of lines used */
  819.  
  820.    char *line[__MAXTOOLBARS];
  821.                       /* pointers to text displayed on each line */
  822.  
  823.    vfnptr function;   /* draw function */
  824.    vfnptr clickfn;    /* click function */
  825.  
  826.    char textindent;   /* how far to indent the text */
  827.  
  828. }__tb_tag;
  829.  
  830.  
  831. /* toolbar control store */
  832.  
  833. typedef struct
  834. {
  835.    char type;        /* control type */
  836.  
  837.    char grey;        /* is it greyed out */
  838.  
  839.    char bar;         /* which line of the toolbar 0, 1, etc. */
  840.    char position;    /* position on bar */
  841.  
  842.    char *text;       /* title or label */
  843.  
  844.    char cstart;      /* combo start position - like for dbox */
  845.  
  846.    char mstart;
  847.    char mend;        /* mouse activation zone - set by draw function */
  848.  
  849.    char xsize;
  850.    char ysize;       /* size of combo box */
  851.  
  852.    char *list;       /* pointer to list for combo control */
  853.    int iret;         /* integer return value, combo or button toggle   */
  854.  
  855.    vfnptr hfunction; /* toggle on */
  856.    vfnptr sfunction; /* combo select func, button function, toggle off */
  857.  
  858. }__tb_ctrl_tag;
  859.  
  860.  
  861. /* global structure used to handle data for graphics mode
  862.    user supplied functions */
  863.  
  864. typedef struct
  865. {
  866.    char _far *font_table;        /* pointer to font table */
  867.    unsigned ftseg;
  868.    unsigned ftoff;               /* seg and ofs for font table */
  869.  
  870.    byte *vbuf;                   /* screen mimic array pointer */
  871.  
  872.    unsigned gx, gy;              /* screen size in pixels */
  873.    char xchar;
  874.    char ychar;            /* character size in pixels */
  875.  
  876.    vfnptr screen_save;           /* user save restore pixels fns */
  877.    vfnptr screen_restore;
  878.  
  879. }__gm_tag;
  880.  
  881.  
  882. /* structure passes info about user screen save in graphics modes */
  883.  
  884. typedef struct
  885. {
  886.    /* Set on user-save function call */
  887.    unsigned x1;      /* top left and bottom right corners to be saved */
  888.    unsigned y1;
  889.    unsigned x2;
  890.    unsigned y2;
  891.  
  892.    /* Set by user on return */
  893.    char *data; /* pointer to data store in memory */
  894.  
  895. }_pts_tag;
  896.  
  897.  
  898. /* structure to return window size in pixels in graphics screen modes */
  899.  
  900. struct _window_pix
  901. {
  902.    unsigned xorigin;
  903.    unsigned yorigin;
  904.  
  905.    unsigned xsize;
  906.    unsigned ysize;
  907. };
  908.  
  909.  
  910. /* externs for global variables */
  911. /* Don't extern these variables when compiling the library source GLOBALS.C */
  912.  
  913. #if !defined __S_INGLOBAL
  914.  
  915. extern __ds_tag _dbox_spec;
  916. extern __ms_tag _menu_spec;
  917. extern __ws_tag _window_spec;
  918.  
  919. extern __wd_tag _window[];
  920. extern __md_tag _menu[], _popmenu[], __tempmenu;
  921. extern __ss_tag _steph_spec;
  922.  
  923. extern __gm_tag _near __gminfo;
  924. extern _pts_tag _pix_to_save;
  925. extern __tb_ctrl_tag _tb_control[];
  926.  
  927. extern __tb_tag _tool_spec;
  928. extern __sbb_tag _speed_button[];
  929. extern __ssb_tag _speed_spec;
  930.  
  931. extern __dd_tag _dbox[], __tb_store;
  932.  
  933. #endif
  934.  
  935.  
  936. /* function prototypes */
  937.  
  938. /* windowing functions */
  939.  
  940. int _window_build( unsigned win, unsigned posn, unsigned startrows,
  941.       char *title, vfnptr filter, vfnptr keyaction, vfnptr mouseaction );
  942.  
  943. void _window_controls( unsigned win, unsigned char controls );
  944. int _window_size( unsigned win, unsigned against, unsigned newrows );
  945. void _window_set_draw( unsigned win, char drawmode, vfnptr drawfn );
  946.  
  947. void _window_draw( void );
  948. void _window_title( unsigned win, char *newtitle );
  949. int _window_getnextfree( void );
  950.  
  951. unsigned _window_above( unsigned win );
  952. unsigned _window_below( unsigned win );
  953.  
  954. char _window_close( unsigned win );
  955. void _window_maximise( unsigned win );
  956. void _window_minimise( void );
  957.  
  958. unsigned _window_belowandopen( unsigned window );
  959. unsigned _window_aboveandopen( unsigned window );
  960.  
  961. void _window_drawscrollblips( void );
  962. char _window_set_vscroll_pc( unsigned win, int percent );
  963. char _window_set_hscroll_pc( unsigned win, int percent );
  964.  
  965. int _wb_newline( unsigned win );
  966. int _wb_gotoline( unsigned win, unsigned linenum );
  967. int _wb_settext( unsigned win, char *thetext );
  968. int _wb_delline( unsigned win );
  969.  
  970. int _wb_setend( unsigned win, int endcode );
  971. int _wb_getend( unsigned win );
  972.  
  973. void _window_setfixed( unsigned win, char fixed );
  974.  
  975. void _window_refresh( unsigned win );
  976. void _window_refresh_lines( unsigned win, unsigned start, unsigned end,
  977.       char dofixed );
  978. void _window_refresh_all( void );
  979. void _window_clear( unsigned win );
  980.  
  981. int _window_open( unsigned win, char open );
  982. int _window_make_active( unsigned win );
  983. void _window_mouse_functions( unsigned win,
  984.    vfnptr close, vfnptr max, vfnptr min,
  985.    vfnptr size, vfnptr vup, vfnptr vdown,
  986.    vfnptr vdrag, vfnptr vpup, vfnptr vpdown,
  987.    vfnptr hup, vfnptr hdown, vfnptr hdrag,
  988.    vfnptr hpup, vfnptr hpdown, vfnptr unselect,
  989.    vfnptr select, vfnptr activate );
  990.  
  991. void _window_setsyskey( vfnptr filter, vfnptr action );
  992.  
  993. struct _window_pix _window_get_gsize( unsigned win );
  994.  
  995.  
  996. void _wbcc_setcolour( unsigned win, unsigned sline, unsigned schar,
  997.       unsigned eline, unsigned echar, short ink, short paper );
  998. void _wbcc_uncolour( unsigned win, unsigned line );
  999. void _wbcc_getcolour( unsigned win, unsigned line,
  1000.       unsigned qchar, short *inks, short *papers );
  1001.  
  1002.  
  1003. /* menuing functions */
  1004.  
  1005. int _menu_build( unsigned menu, char *menutext, ... );
  1006.  
  1007. char _menu_enable( unsigned menu, unsigned item, char enable );
  1008. void _menu_toggle( void );
  1009. char _menu_check( unsigned menu, unsigned item, char check );
  1010. char _menu_get_check( unsigned menu, unsigned item );
  1011.  
  1012. void _menu_helptext( unsigned menu, char *maintext, char *text, ... );
  1013. void _menu_functions( unsigned menu, void(*afunc)(), ... );
  1014.  
  1015. unsigned _menu_getnextfree( void );
  1016.  
  1017. void _menu_go( void );
  1018.  
  1019. void _loop_setfunction( vfnptr lfunc );
  1020. void _loop_menufunction( vfnptr lfunc );
  1021. void _loop_dboxfunction( vfnptr lfunc );
  1022. void _steph_initialfunction( vfnptr ifunc );
  1023.  
  1024.  
  1025. /* misc functions */
  1026.  
  1027. char _steph_initialise( char gmode );
  1028. void _steph_go( void );
  1029. void _steph_closedown( void );
  1030.  
  1031. void _steph_setupgraphic( unsigned xpix, unsigned ypix,
  1032.       vfnptr save, vfnptr restore );
  1033.  
  1034. void _s_settextposition( char row, char column );
  1035. short _s_gettextcursor( void );
  1036. void _s_settextcursor( short cursor );
  1037. void _s_displaycursor( int onoff );
  1038.  
  1039. int _s_insmode( int onoff );
  1040. char _s_key_for_me( void );
  1041.  
  1042. void _s_time_delay( float seconds );
  1043.  
  1044. char *_s_buildlist( char *liststring );
  1045. char *_s_buildradiolist( char *liststring );
  1046.  
  1047. byte _s_shift_key_read( void );
  1048. void _s_key_read( char *k1, char *k2 );
  1049. char _s_wait_for_key( void );
  1050. void _s_flush_keyboard( void );
  1051.  
  1052. void _steph_version( char *store );
  1053.  
  1054. /* mouse functions */
  1055.  
  1056. void _mouse_off( void );
  1057. void _mouse_vis( int vis );
  1058. int  _mouse_on(void);
  1059. byte _mouse_nowbutton( void );
  1060.  
  1061. /* dialogue box functions */
  1062.  
  1063. int _dbox_build( char dbox, char posn, char wide, char tall, char numctrl,
  1064.    char *title, char *helptext );
  1065. void _dbox_setabspos( unsigned dbox, char xpos, char ypos );
  1066.  
  1067. void _dbox_go( unsigned dbox );
  1068. void _dbox_remove_control( unsigned dbox, unsigned cnum );
  1069.  
  1070. void _dbox_c_label( unsigned dbox, unsigned cnum, char xpos, char ypos,
  1071.    char *text );
  1072.  
  1073. void _dbox_c_frame( unsigned dbox, unsigned cnum, char xpos, char ypos,
  1074.    char xsize, char ysize, char *title);
  1075. void _dbox_c_button( unsigned dbox, unsigned cnum, char xpos, char ypos,
  1076.    char size, char *text, char exitflag, vfnptr function );
  1077.  
  1078. void _dbox_c_check( unsigned dbox, unsigned cnum, char xpos, char ypos,
  1079.    char *text, int initval, vfnptr function );
  1080.  
  1081. void _dbox_c_radio( unsigned dbox, unsigned cnum, char *text,
  1082.    int initval, vfnptr function );
  1083.  
  1084. void _dbox_c_text( unsigned dbox, unsigned cnum, char xpos, char ypos,
  1085.    char xsize, char *title, char *text, vfnptr function, vfnptr filter );
  1086.  
  1087. void _dbox_c_list( unsigned dbox, unsigned cnum, char xpos, char ypos,
  1088.    char xsize, char ysize, char field, unsigned scrolls,
  1089.    char *title, char *list, char exitflag,
  1090.    vfnptr sfunction, vfnptr hfunction );
  1091.  
  1092. void _dbox_c_combo( unsigned dbox, unsigned cnum, char xpos, char ypos,
  1093.    char xsize, char ysize, int initial, char *title, char *list,
  1094.    char exitflag,
  1095.    vfnptr sfunction, vfnptr hfunction );
  1096.  
  1097. void _dbox_setbars( unsigned dbox, char bar1, ... );
  1098. void _dbox_setdependants( unsigned dbox, int dep_one, ... );
  1099.  
  1100. void _dbox_grey( unsigned dbox, unsigned cnum, unsigned radio, char grey );
  1101. void _dbox_draw_control( unsigned dbox, unsigned cnum );
  1102.  
  1103. void _dbox_dragdefault( char drag, char snap );
  1104. void _dbox_setdrag( unsigned dbox, char drag, char snap );
  1105. void _query_dragdefault( char drag );
  1106.  
  1107. void _dbox_set_global_keys( unsigned dbox, vfnptr filter, vfnptr action );
  1108.  
  1109. void _flash_remove( void );
  1110. int _flash_box( char position, char *list );
  1111. int _query_box( char position, char *textlist,
  1112.    char *buttonlist, char *helptext );
  1113.  
  1114.  
  1115. /* speed bar and toolbar functions */
  1116.  
  1117. void _speed_text( char *text );
  1118. void _speed_show( void );
  1119. void _speed_wipebar( void );
  1120.  
  1121. void _speed_setbar( char *text );
  1122. void _speed_drawfn( vfnptr func );
  1123. void _speed_clickfn( vfnptr func );
  1124. int  _speed_button_set( unsigned button, char *text, char chevron, vfnptr func );
  1125. void _speed_button_colour( unsigned button, short ink, short paper );
  1126. void _speed_button_remove( unsigned button );
  1127.  
  1128. int  _toolbar_reserve( char number );
  1129. void _toolbar_wipe( void );
  1130. int  _toolbar_set( char bar, char *text );
  1131. void _toolbar_draw( void );
  1132.  
  1133. void _toolbar_drawfn( vfnptr func );
  1134. void _toolbar_click( vfnptr func );
  1135.  
  1136. int _toolbar_set_button( char control, char bar, char pos, char *text,
  1137.       vfnptr func );
  1138. int _toolbar_set_toggle( char control, char bar, char pos, char *text,
  1139.       char initial, vfnptr onfunc, vfnptr offfunc );
  1140. int _toolbar_set_combo( char control, char bar, char pos, char xsize,
  1141. char ysize, char *text, char *list, char initial, vfnptr sfunc );
  1142.  
  1143. void _toolbar_draw_control( char control );
  1144. void _toolbar_grey( char control, char grey );
  1145. void _toolbar_remove_control( char control );
  1146.  
  1147.  
  1148. /* popup menu functions */
  1149.  
  1150. int _popmenu_build( unsigned menu, char *menutext, ... );
  1151. void _popmenu_go( unsigned menu, char row, char col );
  1152. void _popmenu_functions( unsigned menu, void(*afunc)(), ... );
  1153.  
  1154. void _popmenu_helptext( unsigned menu, char *text, ... );
  1155. char _popmenu_enable( unsigned menu, unsigned item, char enable );
  1156. void _popmenu_toggle( void );
  1157.  
  1158. char _popmenu_check( unsigned menu, unsigned item, char check );
  1159. char _popmenu_get_check( unsigned menu, unsigned item );
  1160. void _popmenu_atmouse( unsigned menu );
  1161.  
  1162.  
  1163. void *_s_realloc( void *buffer, unsigned siz );
  1164. void *_s_malloc( unsigned siz );
  1165. void *_s_strdup( char *text );
  1166.  
  1167. char *_s_buildemptylist( void );
  1168. char *_s_list_item( char *list, unsigned item );
  1169. unsigned _s_list_count( char *list );
  1170.  
  1171. char *_s_list_next( char *list );
  1172. char *_s_list_delete( char *list, unsigned item );
  1173. char *_s_list_insert( char *list, char *item, unsigned at );
  1174. char *_s_list_sort( char *list );
  1175.  
  1176. #endif
  1177.  
  1178. /* END OF FILE */
  1179.